<template>
  <div class="box">
    <select @change="fn">
      <option value="0">0</option>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      <option value="5">5</option>
    </select>

    <button @click="$store.commit('ADD_SUM', 3)">+</button>
    <button @click="$store.commit('SUB_SUM')">-</button>
  </div>
</template>

<script>
export default {
  methods: {
    fn(e) {
      this.$store.dispatch('getNum', e.target.value)
    }
  }
}
</script>

<style lang="less" scoped>
.box {
  margin: 20px 0;
}

button {
  width: 50px;
  margin: 0 10px;
  font-size: 14px;
}

select {
  width: 40px;
}
</style>
